; config.asm
; Configuration data mgmt

	.include "string.inc"
	.include "disk.inc"

	.export get_config
	.export read_config
	
	CONFIG_SIZE = 5
	
	.segment "DATA"
	
cfg_string:	.byte CONFIG_SIZE, 0
cfg_data:	.byte 8, 1, 0, 180, 0

	.segment "CODE"
;	
;	Gets configuration byte
;	INPUT:
;		X .. index
;	OUTPUT:
;		A ... data
;	
get_config:	lda cfg_data, x
			rts

	.segment "BOOT"

config:		.byte 8, 0, 7, "vin.cfg"

;	
;	Reads configuration from file
;	
read_config:
			lda $BA
			bne @lfnok
			lda #8			; default to drive 8
@lfnok:
			sta config
			lda #<cfg_string
			ldx #>cfg_string
			jsr ssetbuf
			lda #<config
			ldx #>config
			jmp dread
